import { MessageService } from "@/service/index";
import { Inject, Controller, Get, Query } from "@midwayjs/core";
import { Context } from "@midwayjs/koa";
import { RateLimit } from "@/decorator/index";

@Controller("/message")
export class APIController {
    @Inject()
    ctx: Context;

    @Inject()
    messageService: MessageService;

    @RateLimit("/message/getMessage", 20, 20, 1)
    @Get("/getMessage",{routerName: __dirname,description:"获取消息",})
    async getUser(@Query() params) {
        const user = await this.messageService.getMessage(params);
        return { success: true, message: "OK", data: user };
    }

    get name(): string {
        return "message";
    }
}
